package exam.model.dao;

import java.util.List;

import exam.common.util.NullCheckUtil;
import exam.model.entity.TQuestionExamEntity;
import exam.system.dao.AbstractDAO;
public class TQuestionExamDAO extends AbstractDAO<TQuestionExamEntity>{
	
	public TQuestionExamDAO() {
		super(TQuestionExamEntity.class);
	}
	
	public List<TQuestionExamEntity> selectListQuestionExam() {
		return super.selectList("select qe from TQuestionExamEntity qe " +
				" inner join qe.questionEntity, qe.examinationEntity");
	}
	
	public List<TQuestionExamEntity> selectListQuestionExam(String query) {
		return super.selectList(query);
	}
	
	public TQuestionExamEntity selectByPk(long id) {
		return super.selectByPk(id);
	}
	
	public void insertQuestionExam(TQuestionExamEntity questionExam) {
		super.insert(questionExam);
	}
	
	public void updateQuestionExam(TQuestionExamEntity questionExam) {
			super.update(questionExam);
	}
	
	public boolean deleteQuestionExam(long id) {
		if (NullCheckUtil.isNull(selectByPk(id))) {
			return false;
		}
		super.delete(id);
		return true;
	}
}
